-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
va-checkbox and va-radio-option: Improved a11y #1442
base: main
Are you sure you want to change the base?
Conversation
@Andrew565 Could we fix the box size and radius to align with the USWDS? Attached shows the USWDS with a 20x20 square size and border radius of 2px. The focus state in the Figma design has a gap between the focus state and the gold outline, USWDS is showing the same thing. Could we follow that design for the focus state. The USWDS also shows a gap. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Andrew565 This looked good to me. I was able to confirm that this resolves the Axe issues. I also gave it a quick test in VoiceOver and everything sounded as expected.
One minor thing I saw was when initially tabbing to the radio group, there's an additional outline next to the first item. My guess is that a stray pseudo or hidden element might be getting styled.
@rsmithadhoc Fixed the ghost outline, thanks for pointing that out. @babsdenney I fixed the outline gaps and made sure the sizing was consistent for both radios and checkboxes. If you inspect a non-checked checkbox or radio, it will appear in the sizing model as though it's 16x16, but this isn't including the 2px border on all sides, which raises the 'total size' to 20x20. Screenshots attached. |
@Andrew565 That makes sense! I don't know where the sizing strays, I overlayed the USWDS elements with the VADS and you can still see that the VADS radio buttons and checkboxes are slightly smaller. It looks like the selected radio button is accurate and matches the USWDS but the selected checkbox state and unselected radio and checkbox states are smaller than USWDS. I also am not sure if this makes a difference but the click area for the USWDS checkboxes and radio buttons is larger than the VADS checkboxes. You can click farther to the right on the UWDS elements. This doesn't make a difference, so it is not necessary to change, but the example we use for the name is misspelled in the storybook for the radio buttons. |
@babsdenney Figured out that the USWDS components were 20x20 PLUS a 2px box-shadow, making them effectively 24x24, which is why the size discrepancy. Fixed this for the checkboxes and radio-options, and also fixed the "Soujourner" typo. Should be good for re-review again now. |
}); | ||
return ( | ||
<div class="usa-radio"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this update will require us to diverge almost completely from the USWDS packages with these classes being removed:
usa-radio__input
usa-radio
There are similar USWDS classes for va-checkbox
too.
Is it possible to keep some USWDS style for padding/margin, spacing, font-size, border-radius by keeping those USWDS classes there and just override whatever we need to override in the component stylesheet? Otherwise we will no longer be receiving any of those upstream updates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FWIW, the usa-radio
class is still there, it's just moving to the containerClass
variable.
As for the rest of the classes that are changing, yes, they are diverging quite a bit from the original USWDS classes, which is why I felt it made sense to replace those classes wholesale rather than try and override them.
For the usa-radio__input
vs. va-radio-option__input
, as an example, in our old stylesheet we were overriding just the margin and position, the USWDS doesn't provide any other styles beyond those. In the new stylesheet, we're overriding the margin, position, height, width, border, and box-shadow properties.
In the old styles and layout, the radio button and checkbox "icons" were being generated on the labels using a ::before
pseudo-element. In the new styles and layout, we're generating those "icons" on the inputs themselves.
Getting the 'tile' variant to display correctly likewise required moving the styles to the div
container, rather than having them live with the label
element, due to the label
not encompassing the input
element.
So we aren't really getting anything useful from USWDS for these elements any more, so I don't see us needing to receive any upstream updates, unless USWDS completely restructures these components in a way similar to how we've done it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jamigibbs Following up on this, did you have any further questions or concerns?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I lost track of this one @Andrew565! We were discussing if these changes should be put on hold for the time being for a few different reasons and then I lost track of things. Here is where we're at I believe:
- The work you did before by adding
role="radio"
androle="checkbox"
fixed the original Voice Control issue. - The ticket you created for USWDS about the original Voice Control issue has movement and it's possible they could be providing a fix that we could just consume.
- The ticket this PR is addressing is not a P0 a11y issue (it's not blocking) but a fix requires us to diverge from USWDS. Diverging causes a concerns about not getting any more updates but it also it means we'd have to come back and revert these changes to sync back up with them later.
I think there was a lot of effort put into this work so I definitely don't want to minimize the accomplishment but I'm wondering if it's a good use of our time making these changes now just to come back to sync the components back up with USWDS especially if your original solution allowed Voice Control to work for the time being.
Correct me if I haven't summarized this right though @babsdenney @micahchiang
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Jami. For Micah and Barb, even though this issue isn't a P0, it is causing issues with Axe and causing screen readers to report twice as many options as there are supposed to be (see attached screenshot from Laura). I agree that making a change now and then making a change again once USWDS fixes the issue is less than ideal, but I must disagree that it's not still worth doing. There's no guarantees as to how quickly USWDS will be able to fix this and release it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Andrew565! I didn't notice that comment before. That problem does seem to have a higher priority than what was mentioned in the ticket description. And it looks like they were able to verify it in Storybook too with MacOS VoiceOver.
So I think at this point I agree with you about the update resolving the miscounting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Andrew565 I had one more hail mary thought; was the original a11y issue a blocking issue? The one that we added the role="radio"
and role="checkbox"
attributes for? Could we possibly remove those attributes and then wait for USWDS to make their fix if that problem wasn't a blocker?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The original issue was an accessibility issue, yes. USWDS's original styles take the checkbox and radio inputs and move them -999px
to the left (i.e. off-screen), which made them unclickable.
@babsdenney Made the improvements that I could.
|
@micahchiang Tested with Verdaccio, everything worked well. The only test that will need to be updated is |
@Andrew565 This is looking great! Thank you so much for making those design changes. The default options look good now. No issues were found now but I am looking at the tile options more closely, and there are a few things to fix here. Thank you for looking into the focus. No worries about that; it will be exciting to get DK's new styles implemented eventually.
|
Chromatic
https://3363-redo-radios-and-checks--65a6e2ed2314f7b8f98609d8.chromatic.com
Description
Closes #3363
Reworks some of the HTML for the va-checkbox and va-radio-option components to be more accessible.
QA Checklist
Screenshots
Before:
After:
Acceptance criteria
Definition of done